<?php
//获取相关商品
error_reporting(0);
require_once 'model/api/Taoapi.php';
require_once 'config.php';

$cid = !($_GET['cid'])?'0':intval($_GET['cid']);
$$sort='commissionNum_desc';

$tplFile="showgoods.html";
$tplCache=$cid.$sort;
$smar=new MySmarty($cache,$cachetime,$moban);
$smarty=$smar->get_smarty();
if(!$smarty->is_cached($tplFile,$tplCache)){
	$Taoapi_Config = Taoapi_Config::Init();
	$Taoapi_Config->setCharset('UTF-8');	$Taoapi_Config->setAppKey($app);
	$Taoapi1 = new Taoapi;
	$Taoapi1->method = 'taobao.taobaoke.items.get';
	$Taoapi1->fields = 'num_iid,title,nick,pic_url,price,click_url,volume,seller_credit_score,shop_click_url';
	$Taoapi1->cid = $cid?$cid:16;
	$Taoapi1->page_no = '1';
	$Taoapi1->page_size = '8';
	$Taoapi1->start_commissionRate = $start_commissionRate;
	$Taoapi1->end_commissionRate = $end_commissionRate;
	$Taoapi1->sort = $sort;
	$Taoapi1->nick = $usernick;
	$result = $Taoapi1->Send('get','xml')->getArrayData();
	$taobaokeItem = $result['taobaoke_items']['taobaoke_item'];
	
	if($taobaokeItem){
		foreach ($taobaokeItem as $row) { 
			$row["click_url"]=base64_encode($row["click_url"]);
			$row["title"]=strip_tags($row["title"]);
			$proItems[]=$row;
		}
	}
	//showgoods
	$smarty->assign("proItems",$proItems);
}
	$smarty->assign("prefixurl",$prefixurl);
	$smarty->assign("lcat",$lcat);
	$smarty->assign("lpro",$lpro);
	$smarty->assign("lpage",$lpage);
	$smarty->assign("rewrite_postfix",$rewrite_postfix);
	$smarty->assign("ljoin",$ljoin);


$smarty->display($tplFile,$tplCache);

?>
